<!--
 * @Description: 流程引擎地址
 * @Author 卞鹏飞 <228443632@qq.com>
 * @create 23/11/24 PM9:37
 -->
<!--setup-->
<script setup>
import { onMounted, getCurrentInstance, ref } from 'vue'
import cfWorkIframe from '@/components/biz-cf-workflow-iframe'
import { useRouterPlus } from '@/router/use-router-plus'
import { isArray, stringPathJoin } from 'sf-utils2'

const { proxy } = getCurrentInstance()
const props = defineProps({})
const emit = defineEmits([])

/* 状态 */
const { route } = useRouterPlus()
const redirectUri = ref()

console.log('route', route)
if (isArray(route.params?.pathMatch)) {
  // 参数
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  const [_, pathQueryString] = route.fullPath.split('?').filter(Boolean) || []
  const pathQuery = pathQueryString ? `?${pathQueryString}` : ''

  redirectUri.value = stringPathJoin('/', route.params.pathMatch.join('/'), pathQuery)
}

/* 方法 */

/* 计算 */

/* 监听 */

/* 周期 */
onMounted(() => {})

/* 暴露 */
defineExpose({
  $: proxy.$
})
</script>

<!--render-->
<template>
  <div class="page flex h-full min-h-page flex-col">
    <cfWorkIframe
      v-bind="route.query"
      :entry="redirectUri"
    />
  </div>
</template>

<!--style-->
<style scoped lang="less"></style>
